﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace testy {
	/// <summary>
	/// klasa odpowiedzi do pytania z pamięcią stanu (zaznaczony/niezaznaczony)
	/// </summary>
	sealed public class CheckedAnswer : Answer {
		private bool isChecked;
		public CheckedAnswer(testy.Answer a, bool isChecked  = false) {
			this.pt = a.Pt;
			this.isProper = a.IsProper;
			this.content = a.Content;
			this.isChecked = isChecked;
		}
		public new  double Pt {
			get { 
				int sign = 0;
				if(isChecked && isProper) {
					sign = 1;
				} else if(isChecked && !isProper) {
					sign = -1;
				}
				return this.pt*sign;
			}
		}
		public bool IsChecked {
			get { return this.isChecked; }
			set { this.isChecked = value; }
		}
		public double Points {
			get {
				return this.pt;
			}
		}
	}
}
